package work.lrl.coupon_discard;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import core.util.TransformCsvData;

import java.nio.charset.Charset;

/**
 * @author Gong.Yang
 */
public class Demo {
    static String prefix = "C:\\work-records\\l陆叶\\lel-卡券废弃\\EyWRJzTTj72sc8DU6Ljx42\\" + "2023-10-12";
    static String file = prefix + ".csv";
    static String outFile = prefix + ".json";

    public static void main(String[] args) {

        JSONArray jsonArray = new JSONArray();
        TransformCsvData.peekCsv(file, 0, x -> {
            if (StrUtil.isNotBlank(x[0])) {
                jsonArray.add(x[0].trim());
            }
        });
        FileUtil.writeString(jsonArray.toString(), outFile, Charset.defaultCharset());
    }
}
